﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OFB.BLL.Context;
using OFB.BLL.ViewModel;

namespace OFB.BLL.Repository
{
    public class ReportFeedbackAnswerBLL
    {
        private ReportFeedbackAnswerContext context;
        public ReportFeedbackAnswerBLL()
        {
            context = new ReportFeedbackAnswerContext();
        }
        public ICollection<ReportFeedbackAnswerDetailViewModel> GetFeedbackAnswerDetail(int fbDetailId)
        {
            return context.FeedbackAnswerDetail.Init("Report_GetFeedbackAnswerDetail",
                                                        context.FeedbackAnswerDetail.BuildParameter("FbDetailId", System.Data.DbType.Int32, fbDetailId))
                                            .MapCollection<ViewModel.ReportFeedbackAnswerDetailViewModel>().GetCollection();
        }

        public ICollection<Domain.FeedbackAnswer> GetFeedbackAnswers(int topicId, int courseId)
        {
            return context.FeedbackAnswers.Init("Report_GetFeedbackAnswers",
                                                        context.FeedbackAnswers.BuildParameter("TopicId", System.Data.DbType.Int32, topicId),
                                                        context.FeedbackAnswers.BuildParameter("CourseId", System.Data.DbType.Int32, courseId))
                                             .MapCollection<Domain.FeedbackAnswer>().GetCollection();

        }
    }
}
